// 变量定义
@font-family-base: system-ui, Avenir, Helvetica, Arial, sans-serif;
@font-weight-normal: 400;
@font-weight-medium: 500;
@line-height-base: 1.5;
@min-width: 320px;
@min-height: 100vh;
@h1-font-size: 3.2em;
@border-radius: 8px;
@primary-color: #646cff;
@primary-color-hover: #535bf2;
@primary-color-light: #747bff;

// 深色主题颜色
@dark-color: rgba(255, 255, 255, 0.87);
@dark-bg: #242424;
@dark-button-bg: #1a1a1a;
@dark-border: #646cff;

// 浅色主题颜色
@light-color: #213547;
@light-bg: #ffffff;
@light-button-bg: #f9f9f9;
@light-border: #747bff;

:root {
  font-family: @font-family-base;
  line-height: @line-height-base;
  font-weight: @font-weight-normal;
  color-scheme: light dark;
  color: @dark-color;
  background-color: @dark-bg;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  font-weight: @font-weight-medium;
  color: @primary-color;
  text-decoration: inherit;

  &:hover {
    color: @primary-color-hover;
  }
}

body {
  margin: 0;
  min-width: @min-width;
  min-height: @min-height;
}

h1 {
  font-size: @h1-font-size;
  line-height: 1.1;
}

button {
  border-radius: @border-radius;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: @font-weight-medium;
  font-family: inherit;
  background-color: @dark-button-bg;
  cursor: pointer;
  transition: border-color 0.25s;

  &:hover {
    border-color: @dark-border;
  }

  &:focus,
  &:focus-visible {
    outline: 4px auto -webkit-focus-ring-color;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    color: @light-color;
    background-color: @light-bg;
  }

  a:hover {
    color: @light-border;
  }

  button {
    background-color: @light-button-bg;
  }
}

